<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
        content="width=device-width, initial-scale=1.0">
<meta name="HandheldFriendly" content="true">
<title>Sample</title>
</head>
<body>
<script>
function getPositionSuccess(position){
   var lat = position.coords.latitude;
   var lon = position.coords.longitude;
   alert("你所在的位置： 经度" + lat + "，纬度" + lon);
}
if (window.navigator.geolocation) {
   var geolocation = window.navigator.geolocation;
   geolocation.getCurrentPosition(getPositionSuccess);
}else{
   alert('你的浏览器不支持地理位置定位');
}
</script>
</body>
</html>
